package com.nanhai.buddhist.college.module.study.dal.mysql.attendancemanagementlog;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.nanhai.buddhist.college.module.study.dal.dataobject.attendanceleavereason.AttendanceLeaveReasonDO;
import com.nanhai.buddhist.college.module.study.dal.dataobject.attendancemanagement.AttendanceManagementDO;
import com.nanhai.buddhist.college.module.study.dal.dataobject.attendancemanagementlog.AttendanceManagementLogDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.study.controller.admin.attendancemanagementlog.vo.*;

/**
 * 请假审核记录 Mapper
 *
 * @author AKai
 */
@Mapper
public interface AttendanceManagementLogMapper extends BaseMapperX<AttendanceManagementLogDO> {

    default PageResult<AttendanceManagementLogDO> selectPage(AttendanceManagementLogPageReqVO reqVO) {
        return selectPageForJoin( reqVO,AttendanceManagementLogDO.class,new MPJLambdaWrapperX<AttendanceManagementLogDO>()
                .eqIfPresent(AttendanceManagementLogDO::getManagementId, reqVO.getManagementId())
                .eqIfPresent(AttendanceManagementLogDO::getNewStatus, reqVO.getNewStatus())
                .eqIfPresent(AttendanceManagementDO::getId, reqVO.getReasonId())
                .eqIfPresent(AttendanceManagementLogDO::getCheckTeacherId, reqVO.getCheckTeacherId())
                .leftJoin(AttendanceManagementDO.class,AttendanceManagementDO::getId,AttendanceManagementLogDO::getManagementId)
                .selectAll(AttendanceManagementLogDO.class)
                .orderByDesc(AttendanceManagementLogDO::getCreateTime));
    }

    default List<AttendanceManagementLogDO> selectList(AttendanceManagementLogExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AttendanceManagementLogDO>()
                .eqIfPresent(AttendanceManagementLogDO::getManagementId, reqVO.getManagementId())
                .eqIfPresent(AttendanceManagementLogDO::getNewStatus, reqVO.getNewStatus())
                .eqIfPresent(AttendanceManagementLogDO::getCheckTeacherId, reqVO.getCheckTeatherId())
                .orderByDesc(AttendanceManagementLogDO::getId));
    }

}
